﻿using System;
using SampleCode.com.amazon.webservices;

namespace SampleCode
{
    public class CallAmazonAdervistingApi_NotWork
    {
        public void SearchBook()
        {
            // Create an instance of the Product Advertising API service
            var ecs = new AWSECommerceService();

            // Create an ItemSearch wrapper
            var search = new ItemSearch();
            //search.AssociateTag = "[Your Associate ID]";
            search.AWSAccessKeyId = "AKIAI2GHRE466TTJCZCA";

            //search.Version = "2011-08-01";

            // Create a request object
            var request = new ItemSearchRequest();

            // Fill the request object with request parameters
            request.ResponseGroup = new string[] {"ItemAttributes"};

            // Set SearchIndex and Keywords
            request.SearchIndex = "Books";
            request.Keywords = "WCF";

            // Set the request on the search wrapper
            search.Request = new ItemSearchRequest[] {request};


            try
            {
                //Send the request and store the response
                //in response
                ItemSearchResponse response =
                    ecs.ItemSearch(search);
            }
            catch (Exception e)
            {

            }
        }
    }
}